class RegexUtil{
    appendTwo(first,second){
        if(!first instanceof RegExp && second instanceof RegExp){
            throw new Error( "first and second should both should be of RegExp" );
        }

        let allFlags = first.flags +second.flags;
        let deDupFlagsSet = new Set(allFlags.split(''));
        let deDupFlags = Array.from(deDupFlagsSet).join('');
        return new RegExp(first.source+second.source,deDupFlags);
    }
}

export default RegexUtil;